package com.mushuilingfeng.ddd.framework.factory;

import com.mushuilingfeng.ddd.framework.ComponentFactoryHolder;
import com.mushuilingfeng.ddd.framework.IDGenerator;

import java.io.Serializable;

/**
 * @author mushuilingfeng
 * @date 2024/9/18
 */

public class DomainIdFactory {
    private DomainIdFactory() {}

    @SuppressWarnings("unchecked")
    public static <T extends Serializable> T nextId() {
        return (T) ComponentFactoryHolder.getComponentFactory().getComponent(IDGenerator.class).nextId();
    }

    @SuppressWarnings("unchecked")
    public static <T extends Serializable> T nextId(Object param) {
        return (T) ComponentFactoryHolder.getComponentFactory().getComponent(IDGenerator.class).nextId(param);
    }

}
